<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('节目信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>code：</p>
                                <input type="text" name="code"/>
                            </li>
                            <li>
                                <p>名称：</p>
                                <input type="text" name="name"/>
                            </li>

                            <li>
                                上线状态：<select name="status">
                                <option value="">所有</option>
                                <option value="0">上线</option>
                                <option value="1">下线</option>
                            </select>

                            <li>
                                <p>注入状态：</p>
                                <input type="text" name=""/>
                            </li>
                            <li class="select-time">
                                <label>创建时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-info" onclick="$.table.importExcel()">
                    <i class="fa fa-upload"></i> 导入
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" >
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "tvProgram";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                importUrl: prefix + "/importData",
                importTemplateUrl: prefix + "/importTemplate",
                modalName: "节目信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键id',
                    visible: false
                },
                {
                    field: 'elementtype',
                    title: '对象类型'
                },
                {
                    field: 'action',
                    title: '操作类型'
                },
                {
                    field: 'code',
                    title: '全局唯一标识code'
                },
                {
                    field: 'pcode',
                    title: '父对象标识'
                },
                {
                    field: 'name',
                    title: '节目名称'
                },
                {
                    field: 'volumncount',
                    title: '分集数'
                },
                {
                    field: 'period',
                    title: '期数'
                },
                {
                    field: 'vname',
                    title: '副标题名称'
                },
                {
                    field: 'posterurl1',
                    title: '主海报'
                },
                {
                    field: 'posterurl2',
                    title: '副海报'
                },
                {
                    field: 'status',
                    title: '上线状态标志',
                    formatter: function (value, row, index) {
                        let str="";
                        if(value=="0"){
                            str="上线";
                        }else{
                            str="下线";
                        }
                        return str;
                    }
                },
                {
                    field: 'bcharging',
                    title: '是否计费',
                    formatter: function (value, row, index) {
                        let str="";
                        if(value=="0"){
                            str="免费";
                        }else{
                            str="付费";
                        }
                        return str;
                    }
                },
                {
                    field: 'bpreview',
                    title: '是否预告片',
                    formatter: function (value, row, index) {
                        let str="";
                        if(value=="0"){
                            str="正片";
                        }else{
                            str="预告片";
                        }
                        return str;
                    }
                },
                {
                    field: 'createTime',
                    title: '创建时间'
                },
                {
                    field: 'updateTime',
                    title: '修改时间'
                },
                {
                    field: 'createBy',
                    title: '创建人'
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5"><a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</html>
